﻿namespace Common
{
    /// <summary>
    /// 网络传输协议封装
    /// </summary>
    public interface IProtocol : INetHead
    {

        /// <summary>
        /// 整个数据包大小
        /// </summary>
        int GetPackageSize();

        /// <summary>
        /// 整个数据包字节流
        /// </summary>
        byte[] Getpackage();

        /// <summary>
        /// 返回数据部分
        /// </summary>
        byte[] GetData();
        /// <summary>
        /// 数据部分大小
        /// </summary>
        /// <returns></returns>
        int GetDataSize();

        /// <summary>
        /// 解析数据包
        /// </summary>
        void  ParsePackage(byte[] indata);
        /// <summary>
        /// 创建数据包,有结构体数据
        /// </summary>
        void CreatPackage(uint bMainID, uint bAssistantID, uint bHandleCode, uint inbReserve, object structobj);
        /// <summary>
        /// 创建空包
        /// </summary>
        void CreatPackage(uint bMainID, uint bAssistantID, uint bHandleCode, uint inbReserve);

        void CreatPackage(TCP_Head head, byte[] data);
    }
}
